#include "main/utils.h"
using namespace std;

vector<int> sumInSortedVec(const vector<int> &vec, const int &sum) {
  int begin = 0;
  int end = vec.size() - 1;
  vector<int> ret;
  while (begin < end) {
    int cur_sum = vec[begin] + vec[end];
    if (cur_sum == sum) {
      ret.push_back(begin);
      ret.push_back(end);
      return ret;
    } else if (cur_sum < sum) {
      ++begin;
    } else {
      --end;
    }
  }
  return {};
}

int main() {
  vector<int> vec = {1, 2, 4, 6, 10};
  int sum = 8;
  vector<int> ret = sumInSortedVec(vec, sum);
  printVec("sum", ret);

  return 0;
}
